import { defineConfig } from 'vitepress'
import { containerPreview, componentPreview } from './preview/plugin/core/index'
// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "橙汁云函数",
  description: "一个好用的云函数系统，支持宝塔、1panel、飞牛nas、群晖、威联通快速拉取部署。",
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '首页', link: '/' },
      { text: '一个橙子pro', link: 'https://yigechengzi.com/' }
    ],

    sidebar: [
      {
        text: '示例/文档',
        items: [
          { text: '快速入门', link: 'guide.md' },
          { text: '更新日志', link: 'log.md' },
          { text: '配置文件', link: 'setting/setting.md' },
          {
            text: '函数类别', link: 'function/index.md', items:
              [
                {
                  text: "函数参数设置",
                  link: 'function/params.md'
                },
                {
                  text: "HTTP",
                  link: 'function/http.md'
                },
                {
                  text: "拦截器",
                  link: 'function/interceptor.md'
                },
                {
                  text: "普通函数",
                  link: 'function/function.md'
                },
              ]
          },
          { text: '环境变量', link: 'env/env.md' },
          { text: '数据库说明', link: 'database/index.md' },
          {
            text: 'cloud-sdk', link: '/cloudsdk/index.md',
            items: [
              {
                text: "登录验证",
                link: '/cloudsdk/token.md'
              }
            ]
          },
        ]
      }
    ],

    socialLinks: [
      { icon: 'github', link: 'https://yigechengzi.com/' }
    ]
  },
  markdown: {
    config: (md) => {
      md.use(containerPreview)
      md.use(componentPreview)
    }
  },
  locales: {
    root: {
      label: "中文",
      lang: "zh-CN",
      link: "/",
      themeConfig: {
        docFooter: {
          prev: '上一页',
          next: '下一页'
        },
        outline: {
          label: '页面导航'
        },
      }
    }
  },
  vite: {
    server: {
      port: 8000,
    },
  },
  async transformHtml(html) {
    return html.replace(/<meta name="generator" content="VitePress v\d+\.\d+\.\d+">/g, '<meta name="generator" content="本程序由一瓶橙汁云函数提供">');
  }
})
